package com.punai.customer.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.punai.common.core.domain.entity.SysDictData;
import com.punai.common.core.domain.entity.SysUser;
import com.punai.common.core.page.TableDataInfo;
import com.punai.common.exception.ServiceException;
import com.punai.common.utils.DictUtils;
import com.punai.common.utils.PageUtils;
import com.punai.common.utils.SecurityUtils;
import com.punai.common.utils.StringUtils;
import com.punai.customer.domain.CusGxFee;
import com.punai.customer.domain.CusGxLinkGk;
import com.punai.customer.domain.CusGxLinkGkCategories;
import com.punai.customer.domain.bo.CusFeatureBo;
import com.punai.customer.domain.bo.FeatureRes1;
import com.punai.customer.domain.contants.CusConstants;
import com.punai.customer.domain.contants.FeatureLinkGkParse;
import com.punai.customer.domain.vo.CusGxFeatureLinkGkVo;
import com.punai.customer.domain.vo.CusLinkGkVo;
import com.punai.customer.mapper.*;
import com.punai.customer.service.ICusGxLinkGkService;
import com.punai.gk.domain.vo.SimplifyVo;
import com.punai.gk.mapper.GkUseDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

/**
 * 标准费用项关联归口Service业务层处理
 *
 * @author zhx
 * @date 2023-03-28
 */
@Service
public class CusGxLinkGkServiceImpl extends ServiceImpl<CusGxLinkGkMapper,CusGxLinkGk> implements ICusGxLinkGkService
{
    @Autowired
    private CusGxLinkGkMapper cusGxLinkGkMapper;
    @Autowired
    private CusGxLinkGkCategoriesMapper cusGxLinkGkCategoriesMapper;
    @Autowired
    private CusGxChapterMapper cusGxChapterMapper;
    @Autowired
    private CusGxFeeMapper cusGxFeeMapper;
    @Autowired
    private CusFeatureMapper cusFeatureMapper;
    @Autowired
    private CusLinkGxfeeCategoryMapper dmcLinkGxfeeCategoryMapper;
    @Autowired
    private CusExpenseCategoriesMapper cusExpenseCategoriesMapper;
    @Autowired
    private GkUseDataMapper gkUseDataMapper;

    /**
     * 查询标准费用项关联归口
     *
     * @param id 标准费用项关联归口主键
     * @return 标准费用项关联归口
     */
    @Override
    public CusGxLinkGk selectCusGxLinkGkById(String id)
    {
        return cusGxLinkGkMapper.selectCusGxLinkGkById(id, SecurityUtils.getCompanyId());
    }

    /**
     * 查询标准费用项关联归口列表
     *
     * @param cusGxLinkGk 标准费用项关联归口
     * @return 标准费用项关联归口
     */
    @Override
    public TableDataInfo selectCusGxLinkGkList(CusGxLinkGk cusGxLinkGk) {
        String chapterId = cusGxLinkGk.getChapterId();
        Long companyId = cusGxLinkGk.getCompanyId();
        if(StringUtils.isEmpty(chapterId)){
            return null;
        }
        List<String> childrenIds = cusGxChapterMapper.selectChildrenIdById(chapterId, companyId);
        childrenIds.add(chapterId);

        PageUtils.startPage();
        List<CusGxLinkGk> cusGxLinkGkFees = cusGxLinkGkMapper.selectCusGxLinkGkFeeList(cusGxLinkGk.getCode(),cusGxLinkGk.getName(), childrenIds, companyId);

        List<SimplifyVo> simplifyVos = gkUseDataMapper.selectIdNameList(companyId);
        Map<String, String> idNameMap = simplifyVos.stream().collect(Collectors.toMap(SimplifyVo::getId, SimplifyVo::getName));

        for (CusGxLinkGk gxLinkGk : cusGxLinkGkFees) {
            String gkItem = gxLinkGk.getGkItem();
            if(StringUtils.isEmpty(gkItem)){
                String nullGkItem = getNullGkItemStr();
                gxLinkGk.setGkItem(nullGkItem);

                Map<String, Map<String, String>> nullGkItemMap = new HashMap<>();
                List<SysDictData> gk_categorys = DictUtils.getDictCache("gk_categorys");
                if (gk_categorys != null) {
                    gk_categorys.forEach(sysDictData -> nullGkItemMap.put(sysDictData.getDictValue(),new HashMap<>()));
                }
                gxLinkGk.setLinkGkMap(nullGkItemMap);
            }else {
//                gxLinkGk.setLinkGkMap(JSON.parseObject(gxLinkGk.getGkItem(),Map.class));
                gxLinkGk.setLinkGkMap(addGkName(gxLinkGk.getGkItem(),idNameMap));
                }
            }
        Long total = new PageInfo(cusGxLinkGkFees).getTotal();
        return new TableDataInfo(cusGxLinkGkFees,total.intValue());
    }

    @Override
    public List<CusGxLinkGk> getChildren(String gxId, Long companyId) {
        List<CusGxLinkGk> cusGxLinkGkFeatures = cusGxLinkGkMapper.selectCusGxLinkGkFeatureList(gxId, companyId);
        List<SimplifyVo> simplifyVos = gkUseDataMapper.selectIdNameList(companyId);
        Map<String, String> idNameMap = simplifyVos.stream().collect(Collectors.toMap(SimplifyVo::getId, SimplifyVo::getName));

        Map<String,String> featureMsgMap = new HashMap<>();
        for (CusGxLinkGk cusGxLinkGkFeature : cusGxLinkGkFeatures) {
            StringBuilder featureItem = new StringBuilder(cusGxLinkGkFeature.getFeatureItem());
            Map<String,List<String>> featureItemMap = JSON.parseObject(featureItem.toString(), Map.class);
            featureItem = new StringBuilder();
            List<String> ids = featureItemMap.get("ids");
            List<String> items = featureItemMap.get("items");
            String lastFeatureId = "";
            for (int i = 0; i < ids.size(); i++) {
                String featureId = ids.get(i);
                if(StringUtils.isEmpty(featureId)){
                    continue;
                }
                String item = items.get(i);
                if(StringUtils.equals(lastFeatureId,featureId)){
                    featureItem.append("|").append(item);
                    continue;
                }
                String featureName;
                if(featureMsgMap.containsKey(featureId)){
                    featureName = featureMsgMap.get(featureId);
                }else {
                    featureName =  cusFeatureMapper.selectNameById(featureId, companyId);
                    if(StringUtils.isEmpty(featureName)){
                        featureName = "id:"+featureId+"被特征字典删除";
                    }
                    featureMsgMap.put(featureId,featureName);
                }
                featureItem.append(",").append(featureName).append(":").append(item);
                lastFeatureId = featureId;
            }
            cusGxLinkGkFeature.setFeatureItem(featureItem.substring(1));
//            cusGxLinkGkFeature.setLinkGkMap(JSON.parseObject(cusGxLinkGkFeature.getGkItem(),Map.class));
            cusGxLinkGkFeature.setLinkGkMap(addGkName(cusGxLinkGkFeature.getGkItem(),idNameMap));
        }
        return cusGxLinkGkFeatures;
    }

    /**
     * 新增标准费用项关联归口
     *
     * @param cusGxLinkGk 标准费用项关联归口
     * @return 结果
     */
    @Override
    public int insertCusGxLinkGk(CusGxLinkGk cusGxLinkGk)
    {
            return cusGxLinkGkMapper.insert(cusGxLinkGk);
    }

    @Override
    @Transactional
    public String insertCusGxFeatureLinkGk(List<CusGxFeatureLinkGkVo> featureLinkGkVos, Long companyId) {

        if(featureLinkGkVos.size() == 0){
            throw new ServiceException("未选择特征");
        }
        String gxId = featureLinkGkVos.get(0).getGxId();
        String specId = featureLinkGkVos.get(0).getSpecId();

        CusGxLinkGk cusGxLinkGkFee = cusGxLinkGkMapper.selectCusGxLinkGkById(gxId,companyId);
        // 只有标准费用项会存在没有数据的情况
        if(Objects.isNull(cusGxLinkGkFee)){
            insertDataGx(gxId,specId,companyId);
        }
        Integer maxOrderNumByGxId = 0;
        // 新增特征描述,如果之前没有特征描述
        if(Objects.isNull(cusGxLinkGkFee) || !StringUtils.equals(cusGxLinkGkFee.getFeatureState(),"1")){
            //      1,把之前的1挂3清空
            //      2,清空自己分包模式,成本归口,CBS归口
            dmcLinkGxfeeCategoryMapper.setLinkGkNull(gxId,companyId,getNullGkItemStr());
            cusGxLinkGkMapper.clearFCC(gxId,companyId);
            // 修改状态为启用特征
            cusGxLinkGkMapper.updateFeatureStateIsOne(gxId,companyId);
        }else {
            maxOrderNumByGxId = cusGxLinkGkMapper.getMaxOrderNumByGxId(gxId, companyId);
        }
        List<String> categoryIds = dmcLinkGxfeeCategoryMapper.selectCategoryIdByGxId(companyId, gxId);
        String nullGkItem = getNullGkItemStr();
        int allCount = featureLinkGkVos.size();
        int succeedCount = 0;
        int existCount = 0;
        for (int i = 0; i < featureLinkGkVos.size(); i++) {
            CusGxFeatureLinkGkVo featureLinkGkVo = featureLinkGkVos.get(i);
            List<String> featureIds = featureLinkGkVo.getFeatureIds();
            List<String> items = featureLinkGkVo.getItems();
            // 判断重复
            FeatureLinkGkParse parse = new FeatureLinkGkParse();
            parse.setIds(featureIds);
            parse.setItems(items);
            String featureItem = JSON.toJSONString(parse);
            // 判断重复
            if(cusGxLinkGkMapper.selectCountByFeatureItem(gxId,companyId,featureItem) != 0){
                existCount++;
                continue;
            }
            CusGxLinkGk cusGxLinkGk = new CusGxLinkGk();
            cusGxLinkGk.setCompanyId(companyId);
            cusGxLinkGk.setSpecId(specId);
            cusGxLinkGk.setGxId(gxId);
            cusGxLinkGk.setType(CusConstants.TZ_TYPE);
            cusGxLinkGk.setFeatureState("9");
            cusGxLinkGk.setFeatureItem(featureItem);
            cusGxLinkGk.setGkItem(nullGkItem);
            cusGxLinkGk.setOrderNum(++maxOrderNumByGxId);
            cusGxLinkGkMapper.insert(cusGxLinkGk);
            succeedCount++;
            String featureLinkGkId = cusGxLinkGk.getId();

            int orderNum = 0;
            for (String categoryId : categoryIds){
                CusGxLinkGkCategories cusGxLinkGkCategories = new CusGxLinkGkCategories();
                cusGxLinkGkCategories.setCompanyId(companyId);
                cusGxLinkGkCategories.setSpecId(specId);
                cusGxLinkGkCategories.setGxId(gxId);
                cusGxLinkGkCategories.setGxLinkGkId(featureLinkGkId);
                cusGxLinkGkCategories.setCategoriesId(categoryId);
                cusGxLinkGkCategories.setGkItem(nullGkItem);
                cusGxLinkGkCategories.setOrderNum(++orderNum);
                cusGxLinkGkCategoriesMapper.insert(cusGxLinkGkCategories);
            }
        }
        return "合计："+allCount+"，成功："+succeedCount+"，已存在："+existCount;
    }


    /**
     * 修改标准费用项关联归口
     *
     * @param cusLinkGkVo 关联归口Vo
     * @return 结果
     */
    @Override
    @Transactional
    public int updateCusGxLinkGk(CusLinkGkVo cusLinkGkVo)
    {
        String id = cusLinkGkVo.getId();
        Long companyId = SecurityUtils.getCompanyId();
        String specId = cusLinkGkVo.getSpecId();
        String useRange = cusLinkGkVo.getUseRange();
        String gkType = cusLinkGkVo.getCategory();
        String gkId = cusLinkGkVo.getGkId();
        String gxId = cusGxLinkGkMapper.selectGxIdById(id, companyId);

        if (StringUtils.equals(useRange, CusConstants.USE_RANGE_FEE)) {
            // 自己
            if(StringUtils.isEmpty(gxId)) {
                insertDataGxAppointGkItem(id,specId,companyId,gkType,gkId);
            }else {
                Set<String> gxIds = new HashSet<>(1);
                gxIds.add(gxId);
                cusGxLinkGkMapper.updateGkItemByGxIds(companyId,gxIds,gkType,gkId);
            }
        } else if (StringUtils.equals(useRange, CusConstants.USE_RANGE_FBGC)) {
            // 分部工程
            gxId = StringUtils.defaultIfBlank(gxId, id);
            List<String> gxIds = cusGxFeeMapper.selectWithFbgc(companyId, gxId);
            Set<String> existIds = new HashSet<>(cusGxLinkGkMapper.selectGxIdByGxIds(companyId, gxIds));
            // 先把已经存在的进行设置
            cusGxLinkGkMapper.updateGkItemByGxIds(companyId,existIds,gkType,gkId);
            List<String> noExistIds = gxIds.stream().filter(item -> !existIds.contains(item)).collect(Collectors.toList());

            if(CollUtil.isNotEmpty(noExistIds)) {
                // 然后设置不存在的
                SysUser user = SecurityUtils.getLoginUser().getUser();
                String createBy = user.getUserName() + "@_@" + user.getNickName();
                Map<String, String> nullGkItemMap = getNullGkItemMap();
                nullGkItemMap.put(gkType, gkId);
                cusGxLinkGkMapper.insertByGxIds(companyId, specId, CusConstants.GX_TYPE, noExistIds, JSON.toJSONString(nullGkItemMap), createBy);
            }
        } else if (StringUtils.equals(useRange, CusConstants.USE_RANGE_ZY)) {
            // 专业
            // 先把已经存在的进行设置
            cusGxLinkGkMapper.updateGkItemBySpecId(companyId,specId,gkType,gkId);
            // 然后设置不存在的
            SysUser user = SecurityUtils.getLoginUser().getUser();
            String createBy = user.getUserName() + "@_@" + user.getNickName();
            Map<String, String> nullGkItemMap = getNullGkItemMap();
            nullGkItemMap.put(gkType,gkId);
            cusGxLinkGkMapper.insertBySpecId(companyId,specId,CusConstants.GX_TYPE,JSON.toJSONString(nullGkItemMap),createBy);
        }else {
            if(StringUtils.isEmpty(gxId)){
                insertDataGxAppointGkItem(id,specId,companyId,gkType,gkId);
            }else {
                cusGxLinkGkMapper.updateGkItemById(id,companyId,gkType,gkId);
            }
        }
        return 200;


    }

    @Override
    @Transactional
    public int setSubpackagePattern(Long companyId, CusLinkGkVo cusLinkGkVo) {
        String id = cusLinkGkVo.getId();

        LambdaQueryWrapper<CusGxLinkGk> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CusGxLinkGk::getId,id);
        wrapper.eq(CusGxLinkGk::getCompanyId,companyId);
        CusGxLinkGk cusGxLinkGk1 = cusGxLinkGkMapper.selectOne(wrapper);
        // 只有标准费用项会存在没有数据的情况
        if(Objects.isNull(cusGxLinkGk1)){
            insertDataGx(id,cusLinkGkVo.getSpecId(),companyId);
        }

        CusGxLinkGk cusGxLinkGk = new CusGxLinkGk();
        cusGxLinkGk.setSubpackagePattern(cusLinkGkVo.getCategory());
        return cusGxLinkGkMapper.update(cusGxLinkGk, wrapper);
    }

    /**
     * 批量删除标准费用项关联归口
     *
     * @param ids 需要删除的标准费用项关联归口主键
     * @return 结果
     */
    @Override
    public int deleteCusGxLinkGkByIds(String[] ids)
    {
        return cusGxLinkGkMapper.deleteCusGxLinkGkByIds(ids);
    }

    @Override
    public int deleteCusGxLinkGkById(String id,Long companyId)
    {
        return cusGxLinkGkMapper.deleteCusGxLinkGkById(id,companyId);
    }

//    @Override
//    public List<FeatureRes> getGxLinkFeature(String id, Long companyId) {
//        List<CusFeatureBo> cusFeatureBos = cusFeatureMapper.selectLinkDataAndEntityCopy(companyId,new String[]{id}, CusConstants.GX_TYPE);
//        List<FeatureRes> featureResList = new ArrayList<>();
//        if (CollUtil.isNotEmpty(cusFeatureBos)) {
//            for (CusFeatureBo cusFeatureBo : cusFeatureBos) {
//                FeatureRes featureRes = new FeatureRes();
////                featureRes.setLinkId(cusFeatureBo.getLinkId());
//                featureRes.setFeatureId(cusFeatureBo.getId());
//                featureRes.setFeatureName(cusFeatureBo.getFeatureName());
//                String featureValues = cusFeatureBo.getFeatureValues();
//                featureRes.setFeatureValues(featureValues);
//                featureRes.setItems(StrUtil.split(featureValues,"|"));
////                featureRes.setInputEntry(cusFeatureBo.getIsInput());
////                featureRes.setDefValue(cusFeatureBo.getDefValue());
////                featureRes.setIsPrefix(cusFeatureBo.getIsPrefix());
////                featureRes.setIsSubject(StringUtils.equals(cusFeatureBo.getIsSubject(),CusConstants.ENABLE_Y_TYPE));
////                featureRes.setIsInput(cusFeatureBo.getIsInput());
//                featureRes.setOrderNum(cusFeatureBo.getOrderNum());
//                featureResList.add(featureRes);
//            }
//        }
//        return featureResList;
//    }

    /**
     * @param id
     * @param companyId
     * @return
     */
    @Override
public List<FeatureRes1> getGxLinkFeature(String id, Long companyId) {
    List<CusFeatureBo> cusFeatureBos = cusFeatureMapper.selectLinkDataAndEntityCopy(companyId, new String[]{id}, CusConstants.GX_TYPE);
    List<FeatureRes1> featureRes1List = new ArrayList<>();
    if (CollUtil.isNotEmpty(cusFeatureBos)) {
        for (CusFeatureBo cusFeatureBo : cusFeatureBos) {
            FeatureRes1 featureRes1 = new FeatureRes1();
            String featureId = cusFeatureBo.getId();
            featureRes1.setId(featureId);
            featureRes1.setFeatureId(featureId);
            String featureName = cusFeatureBo.getFeatureName();
            featureRes1.setName(featureName);
            List<String> split = StrUtil.split(cusFeatureBo.getFeatureValues(), "|");
            List<FeatureRes1> childrenList = new ArrayList<>();
            for (int i = 0; i < split.size(); i++) {
                FeatureRes1 children = new FeatureRes1();
                children.setId(featureId+"|"+i);
                children.setFeatureId(featureId);
                children.setName(split.get(i));
//                children.setFeatureName(featureName+"-"+split.get(i));
                children.setFeatureName(featureName);
                childrenList.add(children);
            }
            featureRes1.setChildren(childrenList);
            featureRes1.setOrderNum(cusFeatureBo.getOrderNum());
            featureRes1List.add(featureRes1);
        }
    }
    return featureRes1List;
}

    @Override
    public int clearLinkGk(String id,String specId, Long companyId) {
        LambdaQueryWrapper<CusGxLinkGk> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CusGxLinkGk::getId,id);
        wrapper.eq(CusGxLinkGk::getCompanyId,companyId);
        CusGxLinkGk cusGxLinkGk1 = cusGxLinkGkMapper.selectOne(wrapper);
        if(Objects.isNull(cusGxLinkGk1)){
            return insertDataGx(id,specId,companyId);
        }else {
            CusGxLinkGk cusGxLinkGk = new CusGxLinkGk();
            cusGxLinkGk.setSubpackagePattern("");
            cusGxLinkGk.setGkItem(getNullGkItemStr());
            return cusGxLinkGkMapper.update(cusGxLinkGk,wrapper);
        }
    }

    @Override
    @Transactional
    public int deleteFeatureLinkGk(String id,String gxId, Long companyId) {
        // 删除特征
        cusGxLinkGkMapper.deleteCusGxLinkGkById(id,companyId);
        // 删除特征下的类别
        cusGxLinkGkCategoriesMapper.deleteCusGxLinkGkCategoriesByGxLinkGkId(id,companyId);
        // 如果删除的剩0条的话,改变状态为0(表示未启用特征)
        Long featureLinkGkCount = cusGxLinkGkMapper.selectCount(Wrappers.<CusGxLinkGk>lambdaQuery()
                .eq(CusGxLinkGk::getGxId, gxId)
                .eq(CusGxLinkGk::getCompanyId,companyId)
                .eq(CusGxLinkGk::getType,CusConstants.TZ_TYPE)
        );
        if(featureLinkGkCount == 0){
            cusGxLinkGkMapper.updateFeatureStateIsZero(gxId,companyId);
        }
        return 200;
    }

    @Override
    public List<SimplifyVo> getHistoryGx(String specId, String gkType) {
        return cusGxLinkGkMapper.getHistoryGx(SecurityUtils.getCompanyId(), specId, gkType);
    }

    private int insertDataGx(String gxId,String specId,Long companyId){
        if(Objects.isNull(cusGxFeeMapper.selectOne(Wrappers.<CusGxFee>lambdaQuery().eq(CusGxFee::getId,gxId).eq(CusGxFee::getCompanyId,companyId)))){
            throw new ServiceException("数据错误,请刷新!");
        }
        CusGxLinkGk cusGxLinkGk = new CusGxLinkGk();
        cusGxLinkGk.setId(gxId);
        cusGxLinkGk.setSpecId(specId);
        cusGxLinkGk.setGxId(gxId);
        cusGxLinkGk.setCompanyId(companyId);
        cusGxLinkGk.setType("GX");
        cusGxLinkGk.setFeatureState("0");
        cusGxLinkGk.setGkItem(getNullGkItemStr());
        cusGxLinkGk.setOrderNum(0);
        return cusGxLinkGkMapper.insert(cusGxLinkGk);
    }

    private int insertDataGxAppointGkItem(String gxId,String specId,Long companyId,String gkType,String gkId){
        if(Objects.isNull(cusGxFeeMapper.selectOne(Wrappers.<CusGxFee>lambdaQuery().eq(CusGxFee::getId,gxId).eq(CusGxFee::getCompanyId,companyId)))){
            throw new ServiceException("数据错误,请刷新!");
        }
        Map<String, String> gkItemMap = getNullGkItemMap();
        gkItemMap.put(gkType,gkId);
        CusGxLinkGk cusGxLinkGk = new CusGxLinkGk();
        cusGxLinkGk.setId(gxId);
        cusGxLinkGk.setSpecId(specId);
        cusGxLinkGk.setGxId(gxId);
        cusGxLinkGk.setCompanyId(companyId);
        cusGxLinkGk.setType("GX");
        cusGxLinkGk.setFeatureState("0");
        cusGxLinkGk.setGkItem(JSON.toJSONString(gkItemMap));
        cusGxLinkGk.setOrderNum(0);
        return cusGxLinkGkMapper.insert(cusGxLinkGk);
    }

    private String getNullGkItemStr(){
        return JSON.toJSONString(getNullGkItemMap());
    }

    private Map<String,String> getNullGkItemMap(){
        Map<String,String> dictMap = new HashMap<>();
        List<SysDictData> gk_categorys = DictUtils.getDictCache("gk_categorys");
        for (SysDictData sysDictData : gk_categorys) {
            dictMap.put(sysDictData.getDictValue(),"");
        }
        return dictMap;
    }

    Map<String,Map<String,String>> addGkName(String gkItem,Map<String, String> idNameMap){
        if (StrUtil.isEmpty(gkItem)) {
            return new HashMap<>();
        }
        Map<String, String> gkItemMap = JSON.parseObject(gkItem, Map.class);
        Map<String,Map<String,String>> linkGkMap = new HashMap<>();
        for (Map.Entry<String,String> entry: gkItemMap.entrySet()) {
            String gkCategory = entry.getKey();
            String gkId = entry.getValue();

            Map<String, String> idAndNameMap = new HashMap<>();
            idAndNameMap.put("id",gkId);
            idAndNameMap.put("name",idNameMap.get(gkId));
            linkGkMap.put(gkCategory,idAndNameMap);
        }
        return linkGkMap;
    }

}
